﻿namespace Bango.WindowsPhone7_5.SDK
{
	public class BangoAgent
	{
		private static BangoLogger _bangoLogger = new BangoLogger();

		#region Properties

		/// <summary>
		/// The method used to distribute the application.
		/// </summary>
		/// <param name="applicationChannel">The method used to distribute the application, for example "AppStore".</param>
		public static void setApplicationChannel(System.String applicationChannel)
		{
			_bangoLogger.ApplicationChannel = applicationChannel;
		}

		/// <summary>
		/// Gets the method used to distribute the application.
		/// </summary>
		/// <returns>The method used to distribute the application, for example "AppStore".</returns>
		public static System.String getApplicationChannel()
		{
			return _bangoLogger.ApplicationChannel;
		}

		/// <summary>
		/// Sets the type of application.
		/// </summary>
		/// <param name="applicationType">The type of application, for example "Lite".</param>
		public static void setApplicationType(System.String applicationType)
		{
			_bangoLogger.ApplicationType = applicationType;
		}

		/// <summary>
		/// Gets the type of application.
		/// </summary>
		/// <returns>The type of application, for example "Lite".</returns>
		public static System.String getApplicationType()
		{
			return _bangoLogger.ApplicationType;
		}

		/// <summary>
		/// The application version to be used, if this is not supplied then the application version number of the application is used.
		/// </summary>
		/// <param name="applicationVersion">The application version to be used.</param>
		public static void setApplicationVersion(System.String applicationVersion)
		{
			_bangoLogger.ApplicationVersion = applicationVersion;
		}

		/// <summary>
		/// Gets the application version to be used.
		/// </summary>
		/// <returns>The application version to be used.</returns>
		public static System.String getApplicationVersion()
		{
			return _bangoLogger.ApplicationVersion;
		}

		/// <summary>
		/// The period in seconds, that after we receive onSessionEnd call we will still count events in that of the previous session.
		/// </summary>
		/// <param name="continueSessionSeconds">This is the period in seconds.</param>
		public static void setContinueSessionSeconds(System.Int32 continueSessionSeconds)
		{
			_bangoLogger.SessionResumePeriod = continueSessionSeconds;
		}

		/// <summary>
		/// Gets the period in seconds, that after we receive onSessionEnd call we will still count events in that of the previous session.
		/// </summary>
		/// <returns>The period in seconds</returns>
		public static System.Int32 getContinueSessionSeconds()
		{
			return _bangoLogger.SessionResumePeriod;
		}

		/// <summary>
		/// Sets whether or not an attempt should be made to discover the user’s location.
		/// </summary>
		/// <param name="findLocation">Whether or not an attempt should be made to discover the user’s location.</param>
		public static void setFindLocation(System.Boolean findLocation)
		{
			_bangoLogger.FindLocation = findLocation;
		}

		/// <summary>
		/// Gets whether or not an attempt should be made to discover the user’s location.
		/// </summary>
		/// <returns>Whether or not an attempt should be made to discover the user’s location.</returns>
		public static System.Boolean getFindLocation()
		{
			return _bangoLogger.FindLocation;
		}

		/// <summary>
		/// Sets the Location Source method to be used for determining position, possible values are ‘CELL’ and ‘GPS’.
		/// </summary>
		/// <param name="locationSource">The location method to be used.</param>
		public static void setLocationSource(System.String locationSource)
		{
			_bangoLogger.LocationSource = locationSource;
		}

		/// <summary>
		/// Get the Location Source method to be used for determining position.
		/// </summary>
		/// <returns>The location method to be used.</returns>
		public static System.String getLocationSource()
		{
			return _bangoLogger.LocationSource;
		}

		/// <summary>
		/// Enables or disables the logging of events.
		/// </summary>
		/// <param name="logEvents">Should events be logged.</param>
		public static void setLogEnabled(System.Boolean logEvents)
		{
			_bangoLogger.LogEvents = logEvents;
		}

		/// <summary>
		/// Gets whether not events are being logged.
		/// </summary>
		/// <returns>Whether not events are being logged.</returns>
		public static System.Boolean getLogEnabled()
		{
			return _bangoLogger.LogEvents;
		}

		/// <summary>
		/// The URL to post the data to.
		/// </summary>
		/// <param name="postURL">The URL to post the data to.</param>
		public static void setPostURL(System.String postURL)
		{
			_bangoLogger.PostURL = postURL;
		}

		/// <summary>
		/// Whether or not offline storage should be used, the recommend setting for this is true. This will mean that data will not be lost should there be problem transmitting the data.
		/// </summary>
		/// <param name="useOfflineStorage">Should off-line storage be used.</param>
		public static void setUseOfflineStorage(System.Boolean useOfflineStorage)
		{
			_bangoLogger.UseOfflineStorage = useOfflineStorage;
		}

		/// <summary>
		/// Gets whether or not offline storage should be used.
		/// </summary>
		/// <returns>Should off-line storage be used.</returns>
		public static System.Boolean getUseOfflineStorage()
		{
			return _bangoLogger.UseOfflineStorage;
		}

		/// <summary>
		/// Gets the URL to post the data to.
		/// </summary>
		/// <returns>The URL to post the data to.</returns>
		public static System.String getPostURL()
		{
			return _bangoLogger.PostURL;
		}

		/// <summary>
		/// Sets the the User-Agent to be used when posting data.
		/// </summary>
		/// <param name="userAgent">The User-Agent to be used when posting data</param>
		public static void setUserAgent(System.String userAgent)
		{
			_bangoLogger.UserAgent = userAgent;
		}

		/// <summary>
		/// Gets the the User-Agent to be used when posting data.
		/// </summary>
		/// <returns>The User-Agent to be used when posting data</returns>
		public static System.String getUserAgent()
		{
			return _bangoLogger.UserAgent;
		}

		/// <summary>
		/// The unique identifier that you have for the user of the application. For example, this could be an email or a GUID or just a numerical value.
		/// </summary>
		/// <param name="userId">The unique identifier for the user.</param>
		public static void setUserId(System.String userId)
		{
			_bangoLogger.UserId = userId;
		}

		/// <summary>
		/// Gets the unique identifier for the user of the application.
		/// </summary>
		/// <returns>The unique identifier for the user.</returns>
		public static System.String getUserId()
		{
			return _bangoLogger.UserId;
		}

		#endregion

		#region Posting Events

		public static void postEvents()
		{
			_bangoLogger.PostEvents(true);
		}
		
		#endregion

		#region Event logging

		#region Session Events

		#region Start Session

		/// <summary>
		/// Initiates logging, this must be called after the configuration methods but before any other logging or any other session methods.
		/// </summary>
		/// <param name="applicationKey">The Application Key that has been set up for the application using the management tools.</param>
		public static void onStartSession(System.String applicationKey)
		{
			onStartSession(applicationKey, null, null, null);
		}

		/// <summary>
		/// Initiates logging, this must be called after the configuration methods but before any other logging or any other session methods.
		/// </summary>
		/// <param name="applicationKey">The Application Key that has been set up for the application using the management tools.</param>
		/// <param name="eventValue">This is a value that you can associate with the event.</param>
		public static void onStartSession(System.String applicationKey, System.String eventValue)
		{
			onStartSession(applicationKey, eventValue, "", null);
		}

		/// <summary>
		/// Initiates logging, this must be called after the configuration methods but before any other logging or any other session methods.
		/// </summary>
		/// <param name="applicationKey">The Application Key that has been set up for the application using the management tools.</param>
		/// <param name="eventParameters">A Collection of Event Parameters.</param>
		public static void onStartSession(System.String applicationKey, System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.String, System.String>> eventParameters)
		{
			onStartSession(applicationKey, "", "", eventParameters);
		}

		/// <summary>
		/// Initiates logging, this must be called after the configuration methods but before any other logging or any other session methods.
		/// </summary>
		/// <param name="applicationKey">The Application Key that has been set up for the application using the management tools.</param>
		/// <param name="eventValue">This is a value that you can associate with the event.</param>
		/// <param name="eventDetail">Any extra detail that you would like to attach to the event.</param>
		public static void onStartSession(System.String applicationKey, System.String eventValue, System.String eventDetail)
		{
			onStartSession(applicationKey, eventValue, eventDetail, null);
		}

		/// <summary>
		/// Initiates logging, this must be called after the configuration methods but before any other logging or any other session methods.
		/// </summary>
		/// <param name="applicationKey">The Application Key that has been set up for the application using the management tools.</param>
		/// <param name="eventValue">This is a value that you can associate with the event.</param>
		/// <param name="eventParameters">A Collection of Event Parameters.</param>
		public static void onStartSession(System.String applicationKey, System.String eventValue, System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<string, string>> eventParameters)
		{
			onStartSession(applicationKey, eventValue, "", eventParameters);
		}

		/// <summary>
		/// Initiates logging, this must be called after the configuration methods but before any other logging or any other session methods.
		/// </summary>
		/// <param name="applicationKey">The Application Key that has been set up for the application using the management tools.</param>
		/// <param name="eventValue">This is a value that you can associate with the event.</param>
		/// <param name="eventDetail">Any extra detail that you would like to attach to the event.</param>
		/// <param name="eventParameters">A Collection of Event Parameters.</param>
		public static void onStartSession(System.String applicationKey, System.String eventValue, System.String eventDetail, System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.String, System.String>> eventParameters)
		{

			if (System.String.IsNullOrEmpty(applicationKey))
			{
				throw new System.ArgumentException("Api key not specified");
			}

			try
			{
				startSession(applicationKey, eventValue, eventDetail, eventParameters);
			}
			catch (System.Exception ex)
			{
				_bangoLogger.LogInternalErrorCritical(ex);
			}
		}


		/// <summary>
		/// Initiates logging, this must be called after the configuration methods but before any other logging or any other session methods.
		/// </summary>
		/// <param name="applicationKey">The Application Key that has been set up for the application using the management tools.</param>
		/// <param name="eventDetail">Any extra detail that you would like to attach to the event.</param>
		/// <param name="eventValue">This is a value that you can associate with the event.</param>
		/// <param name="eventParameters">A Collection of Event Parameters.</param>
		private static void startSession(System.String applicationKey, System.String eventValue, System.String eventDetail, System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.String, System.String>> eventParameters)
		{
			_bangoLogger.InitLogger(applicationKey);
			_bangoLogger.PostEvents(false);
			_bangoLogger.LogEventStart(eventValue, eventDetail, eventParameters);
		}

		#endregion

		#region End Session

		/// <summary>
		/// Indicates that the session has ended.
		/// </summary>
		public static void onEndSession()
		{
			onEndSession("", "", null);
		}

		/// <summary>
		/// Indicates that the session has ended.
		/// </summary>
		/// <param name="eventValue">This is a value that you can associate with the event.</param>
		public static void onEndSession(System.String eventValue)
		{
			onEndSession(eventValue, "", null);
		}

		/// <summary>
		/// Indicates that the session has ended.
		/// </summary>
		/// <param name="eventParameters">A Collection of Event Parameters.</param>
		public static void onEndSession(System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.String, System.String>> eventParameters)
		{
			onEndSession("", "", eventParameters);
		}

		/// <summary>
		/// Indicates that the session has ended.
		/// </summary>
		/// <param name="eventValue">This is a value that you can associate with the event.</param>
		/// <param name="eventParameters">A Collection of Event Parameters.</param>
		public static void onEndSession(System.String eventValue, System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.String, System.String>> eventParameters)
		{
			onEndSession(eventValue, "", eventParameters);
		}

		/// <summary>
		/// Indicates that the session has ended.
		/// </summary>
		/// <param name="eventValue">This is a value that you can associate with the event.</param>
		/// <param name="eventDetail">Any extra detail that you would like to attach to the event.</param>
		/// <param name="eventParameters">A Collection of Event Parameters.</param>
		public static void onEndSession(System.String eventValue, System.String eventDetail)
		{
			onEndSession(eventValue, eventDetail, null);
		}
		/// <summary>
		/// Indicates that the session has ended.
		/// </summary>
		/// <param name="eventValue">This is a value that you can associate with the event.</param>
		/// <param name="eventDetail">Any extra detail that you would like to attach to the event.</param>
		/// <param name="eventParameters">A Collection of Event Parameters.</param>
		public static void onEndSession(System.String eventValue, System.String eventDetail, System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.String, System.String>> eventParameters)
		{
			try
			{
				endSession(eventValue, eventDetail, eventParameters);
			}
			catch (System.Exception ex)
			{
				_bangoLogger.LogInternalErrorCritical(ex);
			}
		}

		/// <summary>
		/// Indicates that the session has ended.
		/// </summary>
		/// <param name="eventDetail">Any extra detail that you would like to attach to the event.</param>
		/// <param name="eventValue">This is a value that you can associate with the event.</param>
		/// <param name="eventParameters">A Collection of Event Parameters.</param>
		private static void endSession(System.String eventValue, System.String eventDetail,  System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.String, System.String>> eventParameters)
		{
			_bangoLogger.LogEventEnd(eventValue, eventDetail, eventParameters);
			_bangoLogger.SaveProfile();
			_bangoLogger.EndLocationUpdates();
		}

		#endregion
				
		#region Idle

		/// <summary>
		/// Indicates that the session has entered an idle state, for example the application has lost focus.
		/// </summary>
		public static void onIdle()
		{
			onIdle("", "", null);
		}

		/// <summary>
		/// Indicates that the session has entered an idle state, for example the application has lost focus.
		/// </summary>
		/// <param name="eventValue">This is a value that you can associate with the event.</param>
		public static void onIdle(System.String eventValue)
		{
			onIdle(eventValue, "", null);
		}

		/// <summary>
		/// Indicates that the session has entered an idle state, for example the application has lost focus.
		/// </summary>
		/// <param name="eventParameters">A Collection of Event Parameters.</param>
		public static void onIdle(System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.String, System.String>> eventParameters)
		{
			onIdle("", "", eventParameters);
		}

		/// <summary>
		/// Indicates that the session has entered an idle state, for example the application has lost focus.
		/// </summary>
		/// <param name="eventValue">This is a value that you can associate with the event.</param>
		/// <param name="eventDetail">Any extra detail that you would like to attach to the event.</param>
		public static void onIdle(System.String eventValue, System.String eventDetail)
		{
			onIdle(eventValue, eventDetail, null);
		}

		/// <summary>
		/// Indicates that the session has entered an idle state, for example the application has lost focus.
		/// </summary>
		/// <param name="eventValue">This is a value that you can associate with the event.</param>
		/// <param name="eventParameters">A Collection of Event Parameters.</param>
		public static void onIdle(System.String eventValue, System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.String, System.String>> eventParameters)
		{
			onIdle(eventValue, "", eventParameters);
		}

		/// <summary>
		/// Indicates that the session has entered an idle state, for example the application has lost focus.
		/// </summary>
		/// <param name="eventValue">This is a value that you can associate with the event.</param>
		/// <param name="eventDetail">Any extra detail that you would like to attach to the event.</param>
		/// <param name="eventParameters">A Collection of Event Parameters.</param>
		public static void onIdle(System.String eventValue, System.String eventDetail, System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.String, System.String>> eventParameters)
		{
			try
			{
				_bangoLogger.LogEvent(BangoSessionEvents.SESSION_IDLE_START, eventValue, eventDetail, eventParameters);
				_bangoLogger.SaveProfile();
			}
			catch (System.Exception)
			{
			}
		}

		#endregion

		#region Resume

		/// <summary>
		/// Indicates that the session has resumed after an idle state, for example the application has gained focus after losing focus.
		/// </summary>
		public static void onResume()
		{
			onResume("", "", null);
		}

		/// <summary>
		/// Indicates that the session has resumed after an idle state, for example the application has gained focus after losing focus.
		/// </summary>
		/// <param name="eventValue">This is a value that you can associate with the event.</param>
		public static void onResume(System.String eventValue)
		{
			onResume(eventValue, "", null);
		}

		/// <summary>
		/// Indicates that the session has resumed after an idle state, for example the application has gained focus after losing focus.
		/// </summary>
		/// <param name="eventParameters">A Collection of Event Parameters.</param>
		public static void onResume(System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.String, System.String>> eventParameters)
		{
			onResume("", "", eventParameters);
		}

		/// <summary>
		/// Indicates that the session has resumed after an idle state, for example the application has gained focus after losing focus.
		/// </summary>
		/// <param name="eventValue">This is a value that you can associate with the event.</param>
		/// <param name="eventDetail">Any extra detail that you would like to attach to the event.</param>
		public static void onResume(System.String eventValue, System.String eventDetail)
		{
			onResume(eventValue, eventDetail, null);
		}

		/// <summary>
		/// Indicates that the session has resumed after an idle state, for example the application has gained focus after losing focus.
		/// </summary>
		/// <param name="eventValue">This is a value that you can associate with the event.</param>
		/// <param name="eventParameters">A Collection of Event Parameters.</param>
		public static void onResume(System.String eventValue, System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.String, System.String>> eventParameters)
		{
			onResume(eventValue, "", eventParameters);
		}

		/// <summary>
		/// Indicates that the session has resumed after an idle state, for example the application has gained focus after losing focus.
		/// </summary>
		/// <param name="eventValue">This is a value that you can associate with the event.</param>
		/// <param name="eventDetail">Any extra detail that you would like to attach to the event.</param>
		/// <param name="eventParameters">A Collection of Event Parameters.</param>
		public static void onResume(System.String eventValue, System.String eventDetail, System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.String, System.String>> eventParameters)
		{
			try
			{
				_bangoLogger.ReloadProfile();
				_bangoLogger.LogEvent(BangoSessionEvents.SESSION_IDLE_END, eventValue, eventDetail, eventParameters);
			}
			catch (System.Exception)
			{
			}
		}

		#endregion
				
		#endregion

		#region Logging Events

		#region Log Event

		/// <summary>
		/// Logs a generic event.
		/// </summary>
		/// <param name="eventName">The event name is identifier for the type of event that you would like to record. You can create your own event names simply sending it in this field.</param>
		public static void onEvent(System.String eventName)
		{
			onEvent(eventName, "", "", null);
		}

		/// <summary>
		/// Logs a generic event.
		/// </summary>
		/// <param name="eventName">The event name is identifier for the type of event that you would like to record. You can create your own event names simply sending it in this field.</param>
		/// <param name="eventValue">This is a value that you can associate with the event.</param>
		public static void onEvent(System.String eventName, System.String eventValue)
		{
			onEvent(eventName, eventValue, "", null);
		}

		/// <summary>
		/// Logs a generic event.
		/// </summary>
		/// <param name="eventName">The event name is identifier for the type of event that you would like to record. You can create your own event names simply sending it in this field.</param>
		/// <param name="eventValue">This is a value that you can associate with the event.</param>
		public static void onEvent(System.String eventName, System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.String, System.String>> eventParameters)
		{
			onEvent(eventName, "", "", eventParameters);
		}

		/// <summary>
		/// Logs a generic event.
		/// </summary>
		/// <param name="eventName">The event name is identifier for the type of event that you would like to record. You can create your own event names simply sending it in this field.</param>
		/// <param name="eventValue">This is a value that you can associate with the event.</param>
		/// <param name="eventDetail">Any extra detail that you would like to attach to the event.</param>
		public static void onEvent(System.String eventName, System.String eventValue, System.String eventDetail)
		{
			onEvent(eventName, eventValue, eventDetail, null);
		}

		/// <summary>
		/// Logs a generic event.
		/// </summary>
		/// <param name="eventName">The event name is identifier for the type of event that you would like to record. You can create your own event names simply sending it in this field.</param>
		/// <param name="eventValue">This is a value that you can associate with the event.</param>
		/// <param name="eventParameters">A Collection of Event Parameters.</param>
		public static void onEvent(System.String eventName, System.String eventValue, System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.String, System.String>> eventParameters)
		{
			onEvent(eventName, eventValue, null, eventParameters);
		}

		/// <summary>
		/// Logs a generic event.
		/// </summary>
		/// <param name="eventName">The event name is identifier for the type of event that you would like to record. You can create your own event names simply sending it in this field.</param>
		/// <param name="eventValue">This is a value that you can associate with the event.</param>
		/// <param name="eventDetail">Any extra detail that you would like to attach to the event.</param>
		/// <param name="eventParameters">A Collection of Event Parameters.</param>
		public static void onEvent(System.String eventName, System.String eventValue, System.String eventDetail, System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.String, System.String>> eventParameters)
		{
			try
			{
				_bangoLogger.LogEvent(eventName, eventValue, eventDetail, eventParameters);
			}
			catch (System.Exception)
			{
			}
		}

		#endregion

		#region On Demand Video Start

		/// <summary>
		/// Logs an onDemandVideoStart event.
		/// </summary>
		public static void onDemandVideoStart()
		{
			onDemandVideoStart("", "", null);
		}

		/// <summary>
		/// Logs an onDemandVideoStart event.
		/// </summary>
		/// <param name="eventValue">This is a value that you can associate with the event.</param>
		public static void onDemandVideoStart(System.String eventValue)
		{
			onDemandVideoStart(eventValue, "", null);
		}

		/// <summary>
		/// Logs an onDemandVideoStart event.
		/// </summary>
		/// <param name="eventParameters">A Collection of Event Parameters.</param>
		public static void onDemandVideoStart(System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.String, System.String>> eventParameters)
		{
			onDemandVideoStart("", "", eventParameters);
		}

		/// <summary>
		/// Logs an onDemandVideoStart event.
		/// </summary>
		/// <param name="eventValue">This is a value that you can associate with the event.</param>
		/// <param name="eventDetail">Any extra detail that you would like to attach to the event.</param>
		public static void onDemandVideoStart(System.String eventValue, System.String eventDetail)
		{
			onDemandVideoStart(eventValue, eventDetail, null);
		}

		/// <summary>
		/// Logs an onDemandVideoStart event.
		/// </summary>
		/// <param name="eventValue">This is a value that you can associate with the event.</param>
		/// <param name="eventParameters">A Collection of Event Parameters.</param>
		public static void onDemandVideoStart(System.String eventValue, System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.String, System.String>> eventParameters)
		{
			onDemandVideoStart(eventValue, "", eventParameters);
		}

		/// <summary>
		/// Logs an onDemandVideoStart event.
		/// </summary>
		/// <param name="eventValue">This is a value that you can associate with the event.</param>
		/// <param name="eventDetail">Any extra detail that you would like to attach to the event.</param>
		/// <param name="eventParameters">A Collection of Event Parameters.</param>
		public static void onDemandVideoStart(System.String eventValue, System.String eventDetail, System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.String, System.String>> eventParameters)
		{
			try
			{
				if (eventParameters == null)
				{
					eventParameters = new System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.String, System.String>>();
				}
				eventParameters.Add(new System.Collections.Generic.KeyValuePair<System.String, System.String>(BangoConstants.VIDEO_PARAMETERNAME, BangoConstants.VIDEO_ONDEMANDPARAMETER));
				_bangoLogger.LogEvent(BangoSessionEvents.EVENT_VIDEOSTART, eventValue, eventDetail, eventParameters);
			}
			catch (System.Exception)
			{
			}
		}

		#endregion

		#region On Demand Video Stop

		/// <summary>
		/// Logs an onDemandVideoStop event.
		/// </summary>
		public static void onDemandVideoStop()
		{
			onDemandVideoStop("", "", null);
		}

		/// <summary>
		/// Logs an onDemandVideoStop event.
		/// </summary>
		/// <param name="eventValue">This is a value that you can associate with the event.</param>
		public static void onDemandVideoStop(System.String eventValue)
		{
			onDemandVideoStop(eventValue, "", null);
		}

		/// <summary>
		/// Logs an onDemandVideoStop event.
		/// </summary>
		/// <param name="eventParameters">A Collection of Event Parameters.</param>
		public static void onDemandVideoStop(System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.String, System.String>> eventParameters)
		{
			onDemandVideoStop("", "", eventParameters);
		}

		/// <summary>
		/// Logs an onDemandVideoStop event.
		/// </summary>
		/// <param name="eventValue">This is a value that you can associate with the event.</param>
		/// <param name="eventDetail">Any extra detail that you would like to attach to the event.</param>
		public static void onDemandVideoStop(System.String eventValue, System.String eventDetail)
		{
			onDemandVideoStop(eventValue, eventDetail, null);
		}

		/// <summary>
		/// Logs an onDemandVideoStop event.
		/// </summary>
		/// <param name="eventValue">This is a value that you can associate with the event.</param>
		/// <param name="eventParameters">A Collection of Event Parameters.</param>
		public static void onDemandVideoStop(System.String eventValue, System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.String, System.String>> eventParameters)
		{
			onDemandVideoStop(eventValue, null, eventParameters);
		}

		/// <summary>
		/// Logs an onDemandVideoStop event.
		/// </summary>
		/// <param name="eventValue">This is a value that you can associate with the event.</param>
		/// <param name="eventDetail">Any extra detail that you would like to attach to the event.</param>
		/// <param name="eventParameters">A Collection of Event Parameters.</param>
		public static void onDemandVideoStop(System.String eventValue, System.String eventDetail, System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.String, System.String>> eventParameters)
		{
			try
			{
				if (eventParameters == null)
				{
					eventParameters = new System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.String, System.String>>();
				}
				eventParameters.Add(new System.Collections.Generic.KeyValuePair<System.String, System.String>(BangoConstants.VIDEO_PARAMETERNAME, BangoConstants.VIDEO_ONDEMANDPARAMETER));
				_bangoLogger.LogEvent(BangoSessionEvents.EVENT_VIDEOSTOP, eventValue, eventDetail, eventParameters);
			}
			catch (System.Exception)
			{
			}
		}

		#endregion

		#region Live Video Start

		/// <summary>
		/// Logs an onLiveVideoStart event.
		/// </summary>
		public static void onLiveVideoStart()
		{
			onLiveVideoStart("", "", null);
		}

		/// <summary>
		/// Logs an onLiveVideoStart event.
		/// </summary>
		/// <param name="eventValue">This is a value that you can associate with the event.</param>
		public static void onLiveVideoStart(System.String eventValue)
		{
			onLiveVideoStart(eventValue, "", null);
		}

		/// <summary>
		/// Logs an onLiveVideoStart event.
		/// </summary>
		/// <param name="eventParameters">A Collection of Event Parameters.</param>
		public static void onLiveVideoStart(System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.String, System.String>> eventParameters)
		{
			onLiveVideoStart("", "", eventParameters);
		}

		/// <summary>
		/// Logs an onLiveVideoStart event.
		/// </summary>
		/// <param name="eventValue">This is a value that you can associate with the event.</param>
		/// <param name="eventDetail">Any extra detail that you would like to attach to the event.</param>
		public static void onLiveVideoStart(System.String eventValue, System.String eventDetail)
		{
			onLiveVideoStart(eventValue, eventDetail, null);
		}

		/// <summary>
		/// Logs an onLiveVideoStart event.
		/// </summary>
		/// <param name="eventValue">This is a value that you can associate with the event.</param>
		/// <param name="eventParameters">A Collection of Event Parameters.</param>
		public static void onLiveVideoStart(System.String eventValue, System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.String, System.String>> eventParameters)
		{
			onLiveVideoStart(eventValue, "", eventParameters);
		}

		/// <summary>
		/// Logs an onLiveVideoStart event.
		/// </summary>
		/// <param name="eventValue">This is a value that you can associate with the event.</param>
		/// <param name="eventDetail">Any extra detail that you would like to attach to the event.</param>
		/// <param name="eventParameters">A Collection of Event Parameters.</param>
		public static void onLiveVideoStart(System.String eventValue, System.String eventDetail, System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.String, System.String>> eventParameters)
		{
			try
			{
				if (eventParameters == null)
				{
					eventParameters = new System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.String, System.String>>();
				}
				eventParameters.Add(new System.Collections.Generic.KeyValuePair<System.String, System.String>(BangoConstants.VIDEO_PARAMETERNAME, BangoConstants.VIDEO_LIVEPARAMETER));
				_bangoLogger.LogEvent(BangoSessionEvents.EVENT_VIDEOSTART, eventValue, eventDetail, eventParameters);
			}
			catch (System.Exception)
			{
			}
		}

		#endregion

		#region Live Video Stop

		/// <summary>
		/// Logs an onLiveVideoStop event.
		/// </summary>
		public static void onLiveVideoStop()
		{
			onLiveVideoStop("", "", null);
		}

		/// <summary>
		/// Logs an onLiveVideoStop event.
		/// </summary>
		/// <param name="eventValue">This is a value that you can associate with the event.</param>
		public static void onLiveVideoStop(System.String eventValue)
		{
			onLiveVideoStop(eventValue, "", null);
		}

		/// <summary>
		/// Logs an onLiveVideoStop event.
		/// </summary>
		/// <param name="eventParameters">A Collection of Event Parameters.</param>
		public static void onLiveVideoStop(System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.String, System.String>> eventParameters)
		{
			onLiveVideoStop("", "", eventParameters);
		}

		/// <summary>
		/// Logs an onLiveVideoStop event.
		/// </summary>
		/// <param name="eventValue">This is a value that you can associate with the event.</param>
		/// <param name="eventDetail">Any extra detail that you would like to attach to the event.</param>
		public static void onLiveVideoStop(System.String eventValue, System.String eventDetail)
		{
			onLiveVideoStop(eventValue, eventDetail, null);
		}

		/// <summary>
		/// Logs an onLiveVideoStop event.
		/// </summary>
		/// <param name="eventValue">This is a value that you can associate with the event.</param>
		/// <param name="eventParameters">A Collection of Event Parameters.</param>
		public static void onLiveVideoStop(System.String eventValue, System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.String, System.String>> eventParameters)
		{
			onLiveVideoStop(eventValue, "", eventParameters);
		}

		/// <summary>
		/// Logs an onLiveVideoStop event.
		/// </summary>
		/// <param name="eventValue">This is a value that you can associate with the event.</param>
		/// <param name="eventDetail">Any extra detail that you would like to attach to the event.</param>
		/// <param name="eventParameters">A Collection of Event Parameters.</param>
		public static void onLiveVideoStop(System.String eventValue, System.String eventDetail, System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.String, System.String>> eventParameters)
		{
			try
			{
				if (eventParameters == null)
				{
					eventParameters = new System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.String, System.String>>();
				}
				eventParameters.Add(new System.Collections.Generic.KeyValuePair<System.String, System.String>(BangoConstants.VIDEO_PARAMETERNAME, BangoConstants.VIDEO_LIVEPARAMETER));
				_bangoLogger.LogEvent(BangoSessionEvents.EVENT_VIDEOSTOP, eventValue, eventDetail, eventParameters);

			}
			catch (System.Exception)
			{
			}

		}

		#endregion

		#region Search

		/// <summary>
		/// Logs a search event.
		/// </summary>
		public static void onSearch()
		{
			onSearch("", "", null);
		}

		/// <summary>
		/// Logs a search event.
		/// </summary>
		/// <param name="eventValue">This is a value that you can associate with the event.</param>
		public static void onSearch(System.String eventValue)
		{
			onSearch(eventValue, "", null);
		}

		/// <summary>
		/// Logs a search event.
		/// </summary>
		/// <param name="eventParameters">A Collection of Event Parameters.</param>
		public static void onSearch(System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.String, System.String>> eventParameters)
		{
			onSearch("", "", eventParameters);
		}

		/// <summary>
		/// Logs a search event.
		/// </summary>
		/// <param name="eventValue">This is a value that you can associate with the event.</param>
		/// <param name="eventDetail">Any extra detail that you would like to attach to the event.</param>
		public static void onSearch(System.String eventValue, System.String eventDetail)
		{
			onSearch(eventValue, eventDetail, null);
		}

		/// <summary>
		/// Logs a search event.
		/// </summary>
		/// <param name="eventValue">This is a value that you can associate with the event.</param>
		/// <param name="eventParameters">A Collection of Event Parameters.</param>
		public static void onSearch(System.String eventValue, System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.String, System.String>> eventParameters)
		{
			onSearch(eventValue, "", eventParameters);
		}

		/// <summary>
		/// Logs a search event.
		/// </summary>
		/// <param name="eventValue">This is a value that you can associate with the event.</param>
		/// <param name="eventDetail">Any extra detail that you would like to attach to the event.</param>
		/// <param name="eventParameters">A Collection of Event Parameters.</param>
		public static void onSearch(System.String eventValue, System.String eventDetail, System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.String, System.String>> eventParameters)
		{
			try
			{
				_bangoLogger.LogEvent(BangoSessionEvents.EVENT_SEARCH, eventValue, eventDetail, eventParameters);
			}
			catch (System.Exception)
			{
			}
		}

		#endregion

		#region Page view

		/// <summary>
		/// Increments the page view count.
		/// </summary>
		public static void onPageView()
		{
			onPageView("", "", null);
		}

		/// <summary>
		/// Increments the page view count.
		/// </summary>
		/// <param name="eventValue">This is a value that you can associate with the event.</param>
		public static void onPageView(System.String eventValue)
		{
			onPageView(eventValue, "", null);
		}

		/// <summary>
		/// Increments the page view count.
		/// </summary>
		/// <param name="eventParameters">A Collection of Event Parameters.</param>
		public static void onPageView(System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.String, System.String>> eventParameters)
		{
			onPageView("", "", eventParameters);
		}

		/// <summary>
		/// Increments the page view count.
		/// </summary>
		/// <param name="eventValue">This is a value that you can associate with the event.</param>
		/// <param name="eventDetail">Any extra detail that you would like to attach to the event.</param>
		public static void onPageView(System.String eventValue, System.String eventDetail)
		{
			onPageView(eventValue, eventDetail, null);
		}

		/// <summary>
		/// Increments the page view count.
		/// </summary>
		/// <param name="eventValue">This is a value that you can associate with the event.</param>
		/// <param name="eventParameters">A Collection of Event Parameters.</param>
		public static void onPageView(System.String eventValue, System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.String, System.String>> eventParameters)
		{
			onPageView(eventValue, "", eventParameters);
		}

		/// <summary>
		/// Increments the page view count.
		/// </summary>
		/// <param name="eventValue">This is a value that you can associate with the event.</param>
		/// <param name="eventDetail">Any extra detail that you would like to attach to the event.</param>
		/// <param name="eventParameters">A Collection of Event Parameters.</param>
		public static void onPageView(System.String eventValue, System.String eventDetail, System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.String, System.String>> eventParameters)
		{
			try
			{
				_bangoLogger.LogEvent(BangoSessionEvents.EVENT_PAGEVIEW, eventValue, eventDetail, eventParameters);
			}
			catch (System.Exception ex)
			{
			}
		}

		#endregion

		#region Error

		/**
		 * Logs an error event.
		 * @param errorId The id you want to assign to the error.
		 * @param message Any extra detail that you would like to attach to the error.
		 * @param errorClass The class the error occurred in.
		 */
		public static void onError(System.String errorId, System.String message, System.String errorClass)
		{
			onError(errorId, message, errorClass, null);
		}

		/**
		 * Logs an error event.
		 * @param errorId The id you want to assign to the error.
		 * @param message Any extra detail that you would like to attach to the error.
		 * @param errorClass The class the error occurred in.
		 * @param eventParameters A hashtable collection of event parameters.
		 */
		public static void onError(System.String errorId, System.String message, System.String errorClass, System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.String, System.String>> errorParameters)
		{
			try
			{
				_bangoLogger.LogEventError(errorId, message, errorClass, errorParameters);
			}
			catch (System.Exception ex)
			{
				_bangoLogger.LogInternalErrorCritical(ex);
			}
		}

		#endregion

		#endregion

		#endregion


		#region Debugging

		public static string viewBatch()
		{
			return _bangoLogger.viewBatch();
		}

		#endregion

	}
}
